Skip to content

Fix random fails in test_commondata#2474

Open
andrpie wants to merge 1 commit into
masterfrom
fix_art_unc
Open

Fix random fails in test_commondata#2474
andrpie wants to merge 1 commit into
masterfrom
fix_art_unc

Conversation

@andrpie
Copy link
Copy Markdown
Contributor

@andrpie andrpie commented May 19, 2026

As per #2444, test_commondata sometimes randomly fails due to a worker with a different version of some package.

Example list of failing datasets ATLAS_2JET_7TEV_R06/uncertainties.yaml ATLAS_2JET_7TEV_R06/uncertainties_stronger.yaml ATLAS_2JET_7TEV_R06/uncertainties_weaker.yaml ATLAS_TTBAR_13TEV_HADR_DIF/uncertainties_dSig_dyttBar_norm.yaml ATLAS_TTBAR_13TEV_LJ_DIF/uncertainties_dSig_dmttBar_interspectra.yaml ATLAS_TTBAR_13TEV_LJ_DIF/uncertainties_dSig_dmttBar_norm.yaml ATLAS_TTBAR_13TEV_LJ_DIF/uncertainties_dSig_dpTt_interspectra.yaml ATLAS_TTBAR_13TEV_LJ_DIF/uncertainties_dSig_dyt_interspectra.yaml ATLAS_TTBAR_13TEV_LJ_DIF/uncertainties_dSig_dyttBar_interspectra.yaml ATLAS_TTBAR_8TEV_2L_DIF/uncertainties_dSig_dyttBar_norm.yaml ATLAS_TTBAR_8TEV_LJ_DIF/uncertainties_dSig_dmttBar.yaml ATLAS_TTBAR_8TEV_LJ_DIF/uncertainties_dSig_dmttBar_norm.yaml ATLAS_TTBAR_8TEV_LJ_DIF/uncertainties_dSig_dpTt.yaml ATLAS_TTBAR_8TEV_LJ_DIF/uncertainties_dSig_dpTt_norm.yaml ATLAS_TTBAR_8TEV_LJ_DIF/uncertainties_dSig_dyt.yaml ATLAS_TTBAR_8TEV_LJ_DIF/uncertainties_dSig_dyt_norm.yaml ATLAS_TTBAR_8TEV_LJ_DIF/uncertainties_dSig_dyttBar.yaml ATLAS_TTBAR_8TEV_LJ_DIF/uncertainties_dSig_dyttBar_norm.yaml CMS_1JET_8TEV/uncertainties.yaml CMS_2JET_7TEV/uncertainties.yaml CMS_2JET_8TEV/uncertainties.yaml CMS_TTBAR_13TEV_LJ_DIF/uncertainties_d2Sig_dyttBar_dmttBar.yaml CMS_TTBAR_13TEV_LJ_DIF/uncertainties_d2Sig_dyttBar_dmttBar_norm.yaml CMS_TTBAR_13TEV_LJ_DIF/uncertainties_dSig_dmttBar.yaml CMS_TTBAR_13TEV_LJ_DIF/uncertainties_dSig_dmttBar_norm.yaml CMS_TTBAR_13TEV_LJ_DIF/uncertainties_dSig_dpTt_norm.yaml CMS_TTBAR_8TEV_LJ_DIF/uncertainties_dSig_dyttBar_norm.yaml CMS_WPWM_13TEV_ETA/uncertainties_WM.yaml CMS_WPWM_13TEV_ETA/uncertainties_WP.yaml CMS_WPWM_8TEV_MUON/uncertainties.yaml CMS_Z0J_8TEV/uncertainties_PT-Y.yaml CMS_Z0J_8TEV/uncertainties_PT-Y_sys_10.yaml CMS_Z0_13TEV/uncertainties_AFB.yaml CMS_Z0_7TEV_DIMUON/uncertainties.yaml H1_1JET_319GEV_290PB-1_DIF/uncertainties_norm.yaml H1_1JET_319GEV_290PB-1_DIF/uncertainties_wo-lumi.yaml H1_1JET_319GEV_351PB-1_DIF/uncertainties_wo-lumi.yaml H1_2JET_319GEV_290PB-1_DIF/uncertainties_norm.yaml H1_2JET_319GEV_290PB-1_DIF/uncertainties_wo-lumi.yaml H1_2JET_319GEV_351PB-1_DIF/uncertainties_wo-lumi.yaml HERMES_NC_7GEV_ED/uncertainties.yaml LHCB_DY_8TEV_MUON/uncertainties.yaml LHCB_WPWM_8TEV_MUON/uncertainties.yaml LHCB_Z0J_13TEV_2022/uncertainties_dimuon_pT.yaml LHCB_Z0_13TEV/uncertainties_dielectron.yaml LHCB_Z0_13TEV_2022/uncertainties_dimuon_y.yaml LHCB_Z0_8TEV_DIELECTRON/uncertainties.yaml LHCB_Z0_8TEV_MUON/uncertainties.yaml STAR-2009_1JET_200GEV/uncertainties_CC.yaml STAR-2009_1JET_200GEV/uncertainties_CF.yaml STAR-2009_2JET_200GEV/uncertainties_A.yaml STAR-2009_2JET_200GEV/uncertainties_B.yaml STAR-2009_2JET_200GEV/uncertainties_C.yaml STAR-2009_2JET_200GEV_MIDRAP/uncertainties_OS.yaml STAR-2009_2JET_200GEV_MIDRAP/uncertainties_SS.yaml STAR-2012_1JET_510GEV/uncertainties.yaml STAR-2012_2JET_510GEV/uncertainties_A.yaml STAR-2012_2JET_510GEV/uncertainties_B.yaml STAR-2012_2JET_510GEV/uncertainties_C.yaml STAR-2012_2JET_510GEV/uncertainties_D.yaml STAR-2013_1JET_510GEV/uncertainties.yaml STAR-2013_2JET_510GEV/uncertainties_A.yaml STAR-2013_2JET_510GEV/uncertainties_B.yaml STAR-2013_2JET_510GEV/uncertainties_C.yaml STAR-2013_2JET_510GEV/uncertainties_D.yaml STAR-2015_2JET_200GEV_MIDRAP/uncertainties_SS.yaml

All of these uncertainty files are built using covmat_to_artunc or decompose_covmat. These in turn rely on `numpy.linalg.eig' which leaves the evals and evecs unordered, most likely causing random fails.

Changes

This PR introduces ordering of eigenvalues and eigenvectors in util functions covmat_to_artunc and decompose_covmat. It is as follows: eigenvalues are given in decreasing order, and the first non-zero entry of each eigenvector is positive.
I also fixed filters that used numpy.linalg.eig rather than our utils.

Potential to do:

  • check that the covmats for these datasets are unaffected by the changes
  • are both covmat_to_artunc and decompose_covmat necessary? They seem to do the same thing.
  • why is covmat_to_artunc defined twice (in utils.py and correlations.py)?
  • edge case: what if eigenvalues have multiplicities greater than 1?

@scarlehoff
Copy link
Copy Markdown
Member

check that the covmats for these datasets are unaffected by the changes

Yes, please do! This is important

are both covmat_to_artunc and decompose_covmat necessary? They seem to do the same thing.

If they seem to do the same thing (and given that you will most likely have a script to check whether the covmat is the same given the point above) just remove one and check.

why is covmat_to_artunc defined twice (in utils.py and correlations.py)?

Because we are evil and deserve divine punishment. Please remove one for salvation.

edge case: what if eigenvalues have multiplicities greater than 1?

How often does it happen? My naive guess is that float precision + ordering might take care of this edge case as well (up to updates of numpy/scipy that might change the order of operations)

@felixhekhorn felixhekhorn removed their request for review May 19, 2026 12:06
webwizardg99

This comment was marked as spam.

@scarlehoff
Copy link
Copy Markdown
Member

What is the status of this?

https://github.com/NNPDF/nnpdf/actions/runs/26394014558/job/77690240148

The ratio of fail/non fail is getting close to 50% now 😢

@andrpie
Copy link
Copy Markdown
Contributor Author

andrpie commented May 26, 2026

I have been very busy with my annual report the last few days, I'll get back to this PR soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants